<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>首页</title>
</head>
<body>
<h1 style="color: red; text-align: center;"> 学生信息表 </h1>
<div style="width: 1000px;margin: 10px auto;">
    <a href="addPage"> 添加 </a>
</div>
<table style="width: 1000px;" cellpadding="10" cellspacing="0" border="1" align="center">
    <tr>
        <td>id</td>
        <td>姓名</td>
        <td>性别</td>
        <td>图片</td>
        <td>手机号</td>
        <td>兴趣爱好</td>
        <td>创建时间</td>
        <td>更新时间</td>
        <td>操作</td>
    </tr>
    @foreach($students as $student)
        <tr>
            <td>{{$student->id}}</td>
            <td>{{$student->name}}</td>
            <td>{{$student->gender==1?"男":"女"}}</td>
            <td>
                <img style="width: 40px;height: 40px;" src="{{$student->img}}" alt="">
            </td>
            <td>{{$student->phone}}</td>
            <td>
                {{in_array(1,$student->hobby)?"读书,":""}}
                {{in_array(2,$student->hobby)?"旅游,":""}}
                {{in_array(3,$student->hobby)?"编程,":""}}
                {{in_array(4,$student->hobby)?"英语":""}}
            </td>
            <td>{{$student->created_at}}</td>
            <td>{{$student->updated_at}}</td>
            <td>
                <a href="addPage?id={{$student->id}}"> 编辑 </a>
                &nbsp;
                <a href="delStudent?id={{$student->id}}"> 删除 </a>
            </td>
        </tr>
    @endforeach
</table>
</body>
</html>
